// 颜色混合代码
//! 被 wasm 取代
// import blendWorker from "./blendColors?worker";
// const blendPool = new WorkerPool<(arr: number[][]) => number[][]>(
//     blendWorker,
//     3,
//     20
// );
// export const useBlendColor = (arr: number[][]) => {
//     return blendPool.use(({ module }) => module(arr));
// };

// 路径填充代码
// ! 被 wasm 取代
// import { pathFill } from "../utils/pathFill";
// import pathFillWorker from "./pathFill?worker";
// const pathFillPool = new WorkerPool<typeof pathFill>(pathFillWorker, 3);
// export const usePathFill = (A: [number, number], B: [number, number]) => {
//     return pathFillPool.use(({ module }) => module(A, B));
// };

// 油漆桶填充代码
import floodWorker from "../workers/FloodFill?worker";
import { getColorFlood } from "../utils/getColorFlood";
import { Matrix } from "game-algorithm";
import { WorkerPool } from "./WorkerPool";
const floodPool = new WorkerPool<typeof getColorFlood>(floodWorker);
/** 使用 webworker 加速 */
export const useFloodFillWorker = (
    m: Matrix<[number, number]>,
    X: number,
    Y: number
) => {
    return floodPool.use(({ module }) => module(m, X, Y));
};
